<% (display-partial "doctype") %>
<head>
	<% (display-partial "header") %>
</head>

<body>

<div id="wrap">
	<div id="header">
		<% (display-partial "navigation") %>	
		<div class="clear"></div>
	</div>

	<div id="content">
				
		<div class="title nomargin">
			<p><% (title "| Dragonfly web framework") %><p>
		</div>
		
		; TODO for weekend
		; Update this tutorial
		; 
		<h1>Using newLISP Database</h1>
		<% (DF:activate-plugin "nldb") %>
		<% (DF:activate-plugin "dragonfly_nldb") %>
		<% (DF:activate-plugin "dragonfly_tables") %>
		<% (DF:activate-plugin "dragonfly_forms") %>
		<% (use-database "blog.nldb") %>
		<% 
			(if (= Dragonfly:action "save")
				(Dragonfly:new-row "blog.nldb" 'entries ($POST)) 
			)
		%>
		<% (create-table "blog.nldb" 'entries (list "ID" "Headline" "Text" "Author")) %>
		<% (table_open (nldb:list-columns entries)) %>
		<%
		(set 'query (nldb:select-rows 'entries true true))
		%>
		<% (map Dragonfly:table_data query) %>
		<% (table_close) %>
		<br/><br/>

		<%  ; this doesn't work, therefore it's commented out until it's fixed
			;(form-generate-from-columns "blog.nldb" entries)
		%>
		
		<div class="line-dotted"></div>


		<% (benchmark-result) %>
		
		<div class="line-solid"></div>
		
		
	</div><!-- END CONTENT -->
	
</div><!-- END WRAP -->
<% (display-partial "footer") %>

